package kr.co.doriclassic.powerjava.chapter06;

import java.util.Scanner;

public class Gcd {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x;
		int y;
		
		System.out.print("두 개의 정수를 입력하시오(큰수, 작은수)");
		x=sc.nextInt();
		y=sc.nextInt();
		
		System.out.printf("%d과 %d의 ",x,y);
		calGcd(x, y);
	}

	private static void calGcd(int x, int y) {
		int r=0;
		while(y!=0){
			r=x%y;
			x=y;
			y=r;
		}
		System.out.println("최대공약수는"+x+"입니다.");
	}
}
